package day10.supermarket;

import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.io.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Scanner;

/**
 * MarketTest
 * zhangJ
 * 2022/6/30 17:07
 **/
public class MarketTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Market market = Market.getMarket();
        if(market==null){
            System.out.println("新店开张！\n请输入店名和地址：");
            market = new Market(sc.next(), sc.next());
        }
        new SaveThread(market).start();

        while (true){
            System.out.println("-----会员系统---------");
            System.out.println("1.添加会员，2.给会员增加积分，3.兑换礼品，4.查看信息，5.退出");
            int choose = sc.nextInt();
            if(choose==1){
                System.out.println("请输入会员姓名：");
                String name = sc.next();
                System.out.println("请输入会员积分：");
                int jifen = sc.nextInt();
                Card card = new Card(name,jifen);
                market.add(card);

                System.out.println("开卡成功！");
            }else if (choose==4){
                market.show();
            } else if(choose==5){
                Market.setMarket(market);
                return;
            }
        }
    }
}
